﻿<Page
    x:Class="CascadingListExample.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CascadingListExample"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <x:String x:Key="AppName">Cascading List</x:String>
    </Page.Resources>

        <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <TextBlock x:Name="pageTitle" Grid.Column="1" Text="{StaticResource AppName}" Style="{StaticResource HeaderTextBlockStyle}"/>
        </Grid>

        <Grid Grid.Row="1">
            <Grid.DataContext>
                <local:ViewModel/>
            </Grid.DataContext>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="1*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding Number}" HorizontalAlignment="Center" Style="{StaticResource SubheaderTextBlockStyle}" Grid.ColumnSpan="4"/>
            <ListView Grid.Column="0" Grid.Row="1" ItemsSource="{Binding Digits}" SelectedItem="{Binding SelectedOne, Mode=TwoWay}"/>
            <ListView Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Tens}" SelectedItem="{Binding SelectedTen, Mode=TwoWay}"/>
            <ListView Grid.Row="1" Grid.Column="2" ItemsSource="{Binding Hundreds}" SelectedItem="{Binding SelectedHundred, Mode=TwoWay}"/>
            <ListView Grid.Row="1" Grid.Column="3" ItemsSource="{Binding Thousands}" SelectedItem="{Binding SelectedThousand, Mode=TwoWay}"/>
        </Grid>
    </Grid>
</Page>
